﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.resizer {
    import org.aswing.geom.*;

    public class ResizeStrategyImp implements ResizeStrategy {

        private var wSign:Number;
        private var hSign:Number;

        public function ResizeStrategyImp(_arg1:Number, _arg2:Number){
            this.wSign = _arg1;
            this.hSign = _arg2;
        }
        public function getBounds(_arg1:IntRectangle, _arg2:IntDimension, _arg3:IntDimension, _arg4:int, _arg5:int):IntRectangle{
            var _local7:int;
            var _local8:int;
            var _local9:int;
            var _local10:int;
            var _local6:IntRectangle = _arg1.clone();
            if (_arg2 == null){
                _arg2 = new IntDimension(0, 0);
            };
            if (_arg3 == null){
                _arg3 = IntDimension.createBigDimension();
            };
            if (this.wSign == 0){
                _local9 = _local6.width;
            } else {
                _local9 = (_local6.width + (this.wSign * _arg4));
                _local9 = Math.min(_arg3.width, Math.max(_arg2.width, _local9));
            };
            if (this.wSign < 0){
                _local7 = (_local6.x + (_local6.width - _local9));
            } else {
                _local7 = _local6.x;
            };
            if (this.hSign == 0){
                _local10 = _local6.height;
            } else {
                _local10 = (_local6.height + (this.hSign * _arg5));
                _local10 = Math.min(_arg3.height, Math.max(_arg2.height, _local10));
            };
            if (this.hSign < 0){
                _local8 = (_local6.y + (_local6.height - _local10));
            } else {
                _local8 = _local6.y;
            };
            _local7 = Math.round(_local7);
            _local8 = Math.round(_local8);
            _local9 = Math.round(_local9);
            _local10 = Math.round(_local10);
            return (new IntRectangle(_local7, _local8, _local9, _local10));
        }

    }
}//package org.aswing.resizer 
